package c.c.b.b.d;

import android.util.Log;
import c.c.b.b.f.c;
import c.c.b.b.f.m;
import c.c.b.b.f.p;
import c.c.b.b.f.p.a;
import c.c.b.b.f.q;
import java.io.UnsupportedEncodingException;

/* compiled from: JsonRequest */
public abstract class n<T> extends c<T> {
    private static final String c = String.format("application/json; charset=%s", new Object[]{"utf-8"});
    private final Object d = new Object();
    private a<T> e;
    private final String f;

    public n(int i, String str, String str2, a<T> aVar) {
        super(i, str, aVar);
        this.e = aVar;
        this.f = str2;
    }

    public abstract p<T> a(m mVar);

    public void a(p<T> pVar) {
        a aVar;
        synchronized (this.d) {
            aVar = this.e;
        }
        if (aVar != null) {
            aVar.a(pVar);
        }
    }

    public void cancel() {
        super.cancel();
        synchronized (this.d) {
            this.e = null;
        }
    }

    public byte[] getBody() {
        byte[] bArr = null;
        try {
            String str = this.f;
            if (str != null) {
                bArr = str.getBytes(r0);
            }
            return bArr;
        } catch (UnsupportedEncodingException unused) {
            Log.wtf("VNetLog", q.e("Unsupported Encoding while trying to get the bytes of %s using %s", this.f, "utf-8"));
            return null;
        }
    }

    public String getBodyContentType() {
        return c;
    }

    @Deprecated
    public byte[] getPostBody() {
        return getBody();
    }
}
